package com.kischang.blog.web.actionuser;

import com.kischang.blog.model.User;
import com.kischang.blog.service.UserService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
@Scope("prototype")
public class QuitAction extends ActionSupport {

	private static final long serialVersionUID = 4985279868023593436L;

	@Resource
	private UserService userService;
	
	@Override
	public String execute() throws Exception {
		User user = (User) ActionContext.getContext().getSession().get("user");
		userService.updateTicket(user, "");
		ActionContext.getContext().getSession().put("user", null);
		return SUCCESS;
	}

}